package day05;

import java.util.*;

/**
 * 有下列字符串:
 * 销售:张三;财务:李四;销售:王五;财务:赵六;程序:mike;程序:jerry;美工:jackson;前端:green;前端:nick;程序:钱七;销售:alice
 * 分析上述字符串然后统计每个职位总共多少人?
 * 使用Map保存统计的结果，其中key:职位,value为该职位人数
 * 然后分别输出各职位的名称(keySet),各职位人数(entrySet)
 * @author Bonnie
 *
 */
public class Test05 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String str = input.nextLine();
        String[] strs = str.split(";");
        HashMap<String,Integer> map = new HashMap<>();
        for (String s:strs){
            String postion = s.substring(0,2);
            if (map.containsKey(postion)){
                map.put(postion,map.get(postion)+1);
            }else{
                map.put(postion,1);
            }
        }
        Set<String> keys = map.keySet();
        Collection<Integer> values = map.values();
        Set<Map.Entry<String,Integer>> res = map.entrySet();
        for (Map.Entry<String,Integer> n : res){
            System.out.print(n.getKey()+":"+n.getValue());
            System.out.println();
        }

    }
}
